const Keyv = require('keyv');
class ipc{
    static handle(name,func){
        console.log(name);
        switch(name){
            case('keychainGetPassword'):

                break;
            case('keychainSetPassword'):

                break;
            case('keychainDeletePassword'):

                break;
            case('keychainFindCredentials'):
            
                break;
            case('keychainFindPassword'):
            
                break;
            default:
                break;
        }
    }
}
let filename=__dirname+"/key.sqlite"
const keyv = new Keyv('sqlite://'+filename);
keyv.on('error', err => console.log('Connection Error', err));
async function test(){
    await keyv.set('foo', 'expires in 1 second', 1000); // true
    await keyv.set('foo', 'never expires'); // true
    await keyv.get('foo'); // 'never expires'
    // await keyv.delete('foo'); // true
    // await keyv.clear(); // undefined
}
test();
// ipc.handle('keychainGetPassword', function (event, service, account) {
//   // return keytar.getPassword(service, account)
//   await keyv.get(account)
// })

// ipc.handle('keychainSetPassword', function (event, service, account, password) {
//   // return keytar.setPassword(service, account, password)
//   await keyv.set(account,password)
// })

// ipc.handle('keychainDeletePassword', function (event, service, account) {
//   // return keytar.deletePassword(service, account)
//   await keyv.delete(account)
// })

// ipc.handle('keychainFindCredentials', function (event, service) {
//   return keytar.findCredentials(service)
// })

// ipc.handle('keychainFindPassword', function (event, service) {
//   return keytar.setPassword(service)
// });